﻿using MesgessSystem.Help;
using MesgessSystem.Registered;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using CameraPrpject;
using MEF;
using DataStructure;
using Mesgesssystem;
using DevExpress.XtraCharts;
using AsyncDownloadFile;
using System.Threading;
using MesgessSystem.ApplicationInstance;
using LanMessenger;
using MusicPlayer;
using BirthHoroscope;
using WebClone;
using log4net;
using Sunisoft.IrisSkin;
using Weather;
using System.IO;
using SimulationDrawingGDI;
using winMap;
using Message;
using Translate;
using WindowsInfoTool;
using System.Diagnostics;
using BarCodeGenerator;
using ChineseCalender;
using MD5EncryptionDevice;
using SuperSnake;
using SubwayTool;
using PictureBoard4;
using ChatRobot;
using SysLogLook;
using GoBangProject;
using MumiMusic;
using _2048Game;
using Luck;
using PuzzleGame;
using 百度云搜索神器;
using StuApart;
using WindowsColor;
using AutoPlayerNew;
using Xianfen.Net.GetColor;
using System.Runtime.InteropServices;
using CaptureImageToolDemo;
using JXPanel;

namespace MesgessSystem.JXMessgesSystem
{
    public partial class JKMessgesSystem : Form
    {
        private static ILog _log = LogManager.GetLogger(typeof(JKMessgesSystem));
        private SkinEngine skinEngine;
        public JKMessgesSystem()
        {
            InitializeComponent();
            InitInfo();
            _log.Info("初始化皮肤完成");
        }
        /// <summary>
        /// 初始化皮肤
        /// </summary>
        private void InitInfo()
        {
            this.skinEngine = new SkinEngine();
            this.skinEngine.SkinFile = AppDomain.CurrentDomain.BaseDirectory + @"Skins\SteelBlue.ssk";
            this.skinEngine.DisableTag = 9999;
            ReadSkinFile();
        }
        /// <summary>
        /// 读取皮肤文件
        /// </summary>
        private void ReadSkinFile()
        {
            string folder = AppDomain.CurrentDomain.BaseDirectory + "Skins";
            string[] files = Directory.GetFiles(folder);
            foreach (string file in files)
            {
                this.tdBtnSkins.DropDownItems.Add(Path.GetFileNameWithoutExtension(file), null, new EventHandler(tdBtnSkins_ItemClick));
            }
        }
        /// <summary>
        /// 换肤事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tdBtnSkins_ItemClick(object sender, EventArgs e)
        {
            string folder = AppDomain.CurrentDomain.BaseDirectory + "Skins";
            string name = sender.ToString();
            string skinFile = string.Format(@"{0}\{1}.ssk", folder, name);
            this.skinEngine.SkinFile = skinFile;
        }
        /// <summary>
        /// 显示日志到控件richTextBox1上
        /// </summary>
        /// <param name="log"></param>
        public void ReadLog(string log)
        {
            try
            {
                this.BeginInvoke(new Action(() => {
                    string time = Convert.ToString(DateTime.Now);
                    richTextBox1.AppendText(time + " " + log + "\n");
                }));
            }
            catch (Exception ex) 
            {
                _log.Error(ex.Message);
            }            
        }

        private void 关于ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了关于窗体");
            ReadLog("打开了关于窗体");
            JKAboutBox Kj = new JKAboutBox();
            Kj.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了关于窗体";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }

        private void 用户注册ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了注册窗体");
            ReadLog("打开了注册窗体");
            UserRegistered zhuce = new UserRegistered();
            zhuce.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了注册窗体";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 退出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("  确  定  退  出  ？  ？  ？", "提  示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                _log.Debug("System Exit........");
                Application.Exit();
            }     
        }

        private void 单摄像头ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了单摄像头窗体");
            ReadLog("打开了单摄像头窗体");
            CameateThree cc = new CameateThree();
            //Cameara cc = new Cameara();
            //Cemeratow cc = new Cemeratow();
            cc.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了单摄像头窗体";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 系统关闭退出
        /// 一定注意各个对象的退出顺序
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        //bool m_InformSysExiting = false;
        private void JXMasterFormEx_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (MessageBox.Show("  确  定  退  出  ？", "提  示", MessageBoxButtons.YesNo, MessageBoxIcon.None) == DialogResult.Yes)
            {
                this.Cursor = Cursors.WaitCursor;
                this.Cursor = Cursors.Arrow;
                //SysLog.Info("系统退出");
                _log.Info("系统退出");
                _log.Debug("System Exit........");
                Environment.Exit(0);
                //Application.ExitThread();
            }
            else
            {
                e.Cancel = true;
            }         
        }
        #region 窗体启动动画    --弃用
        ///// <summary>
        ///// 窗体动画函数
        ///// </summary>
        ///// <param name="hwnd">指定产生动画的窗口的句柄</param>
        ///// <param name="dwTime">指定动画持续的时间</param>
        ///// <param name="dwFlags">指定动画类型，可以是一个或多个标志的组合。</param>
        ///// <returns></returns>
        //[DllImport("user32")]
        //private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
        ////下面是可用的常量，根据不同的动画效果声明自己需要的
        //private const int AW_HOR_POSITIVE = 0x0001;//自左向右显示窗口，该标志可以在滚动动画和滑动动画中使用。使用AW_CENTER标志时忽略该标志
        //private const int AW_HOR_NEGATIVE = 0x0002;//自右向左显示窗口，该标志可以在滚动动画和滑动动画中使用。使用AW_CENTER标志时忽略该标志
        //private const int AW_VER_POSITIVE = 0x0004;//自顶向下显示窗口，该标志可以在滚动动画和滑动动画中使用。使用AW_CENTER标志时忽略该标志
        //private const int AW_VER_NEGATIVE = 0x0008;//自下向上显示窗口，该标志可以在滚动动画和滑动动画中使用。使用AW_CENTER标志时忽略该标志该标志
        //private const int AW_CENTER = 0x0010;//若使用了AW_HIDE标志，则使窗口向内重叠；否则向外扩展
        //private const int AW_HIDE = 0x10000;//隐藏窗口
        //private const int AW_ACTIVE = 0x20000;//激活窗口，在使用了AW_HIDE标志后不要使用这个标志
        //private const int AW_SLIDE = 0x40000;//使用滑动类型动画效果，默认为滚动动画类型，当使用AW_CENTER标志时，这个标志就被忽略
        //private const int AW_BLEND = 0x80000;//使用淡入淡出效果
        #endregion
        private void JKMessgesSystem_Load(object sender, EventArgs e)
        {
            #region 窗体启动动画    --弃用
            //int x = Screen.PrimaryScreen.WorkingArea.Left + 510;
            //int y = Screen.PrimaryScreen.WorkingArea.Top + 300;
            //this.Location = new Point(x, y);//设置窗体在屏幕右下角显示
            //AnimateWindow(this.Handle, 2000, AW_SLIDE | AW_ACTIVE | AW_VER_POSITIVE);
            #endregion
            DateTime appStartTime = Process.GetCurrentProcess().StartTime;
            string startTime = string.Format("【软件启动时间：{0}】", appStartTime.ToString("MM-dd HH:mm"));
            toolStripStatusLabel3.Text = startTime;            
            ReadLog("初始化皮肤完成"); //调用ReadLog向richTextBox1内写入日志
            ReadLog("初始化电池理论功率、电池实际功率完成");
            YingCang();
            DataTable _dt = CreateTestDB();
            chartControl1.CreateSeries("电池理论功率", ViewType.Spline, _dt, "time", "Power");
            chartControl1.CreateSeries("电池实际功率", ViewType.Spline, _dt, "time", "ActulPower");
            this.Left = (int)((Screen.PrimaryScreen.Bounds.Width - this.Width) / 2);
            this.Top = (int)((Screen.PrimaryScreen.Bounds.Height - this.Height) / 2);
        }

        /// <summary>
        /// 准备数据源
        /// </summary>
        /// <returns></returns>
        private DataTable CreateTestDB()
        {
            DataTable _testData = new DataTable();
            _testData.Columns.Add(new DataColumn("time", typeof(string)));
            _testData.Columns.Add(new DataColumn("Power", typeof(decimal)));
            _testData.Columns.Add(new DataColumn("ActulPower", typeof(decimal)));
            Random _rm = new Random();
            for (int i = 0; i < 24; i++)
            {
                DataRow _drNew = _testData.NewRow();
                _drNew["time"] = string.Format("{0}点", i);
				//_drNew["Power"] = 250;
				_drNew["Power"] = _rm.Next(150, 245);
				_drNew["ActulPower"] = _rm.Next(220, 245);
                _testData.Rows.Add(_drNew);
            }
            return _testData;
        }

        /// <summary>
        /// 需要隐藏的功能
        /// </summary>
        void YingCang()
        {
            退出ToolStripMenuItem.Visible = false;
        }
        //AsyDownloadFile asyDownloadFile = null;
        //Thread syDownloadFile;
        private void 异步下载文件ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了异步下载文件窗体");
            ReadLog("打开了异步下载文件窗体");
            //syDownloadFile = new Thread(new ThreadStart(this.GetDownloadFile));
            //syDownloadFile.Start();
            AsyDownloadFile asyDownloadFile = new AsyDownloadFile();
			asyDownloadFile.Show();
        }

		private void timer1_Tick(object sender, EventArgs e)
		{
			toolStripStatusLabel1.Text = "系统当前时间为：" + DateTime.Now.ToLongTimeString();//动态显示系统时间     
		}
        /// <summary>
        /// C#程序范例
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CStripMenuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了C#程序范例窗体");
            ReadLog("打开了C#程序范例窗体");
            ApplicationForm Af = new ApplicationForm();
            Af.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了C#程序范例窗体";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 局域网信使
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolStripMenuItemLan_Click(object sender, EventArgs e)
        {
            _log.Info("打开了局域网信使窗体");
            ReadLog("打开了局域网信使窗体");
            LanMain lans = new LanMain();
            lans.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了局域网信使窗体";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 音乐播放器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MediaPlayer_Click(object sender, EventArgs e)
        {
            _log.Info("打开了音乐播放器窗体");
            ReadLog("打开了音乐播放器窗体");
            MainForm mainForm = new MainForm();
            mainForm.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了音乐播放器窗体";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 生辰八字计算器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BirthHoroscope_Click(object sender, EventArgs e)
        {
            _log.Info("打开了生辰八字计算器窗体");
            ReadLog("打开了生辰八字计算器窗体");
            BirthFrm birthFrm = new BirthFrm();
            birthFrm.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了生辰八字计算器窗体";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        #region 暂时没用
        //void GetDownloadFile()
        //{
        //    try
        //    {
        //        this.BeginInvoke(new Action(() => {
        //            //if (asyDownloadFile == null)
        //            //{
        //            //    asyDownloadFile = new AsyDownloadFile();
        //            //    asyDownloadFile.Show();
        //            //}
        //            //if (asyDownloadFile.Visible == false)
        //            //{
        //            //    asyDownloadFile.Show();
        //            //}
        //            //else
        //            //{
        //            //    asyDownloadFile.Activate();
        //            //}
        //            AsyDownloadFile asyDownloadFile = new AsyDownloadFile();
        //            asyDownloadFile.Show();
        //        }));          
        //    }
        //    catch (Exception e)
        //    {

        //        //throw;
        //        e.ToString();
        //    }

        //}


        //public IEnumerable<IPlugin> plugins;
        //void ExitPlugings()
        //{
        //    foreach (IPlugin plugin in plugins)
        //    {
        //        plugin.Exit();
        //    }
        //}
        #endregion
        
        /// <summary>
        /// 网站克隆
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WebClone_Click(object sender, EventArgs e)
        {
            _log.Info("打开了网站克隆窗体");
            ReadLog("打开了网站克隆窗体");
            WebClonefrm webclone = new WebClonefrm();
            webclone.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了网站克隆窗体";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 天气预报查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WeatherTool_Click(object sender, EventArgs e)
        {
            _log.Info("打开了天气预报查询窗体");
            ReadLog("打开了天气预报查询窗体");
            Weatherfrm WFRM = new Weatherfrm();
            WFRM.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了天气预报查询窗体";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }

        #region 鼠标位置
        void MonseMove(MouseEventArgs e)
        {
            string promt = "鼠标位置：(" + e.X.ToString() + "," + e.Y.ToString() + ")";
            toolStripStatusLabel2.Text = promt;
        }
        private void JKMessgesSystem_MouseMove(object sender, MouseEventArgs e)
        {
            MonseMove(e);
        }

        private void menuStrip1_MouseMove(object sender, MouseEventArgs e)
        {
            MonseMove(e);
        }

        private void chartControl1_MouseMove(object sender, MouseEventArgs e)
        {
            MonseMove(e);
        }
        private void richTextBox1_MouseMove(object sender, MouseEventArgs e)
        {
            MonseMove(e);
        }
        #endregion
        /// <summary>
        /// 模拟绘图GDI+
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GDIToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了模拟绘图GDI+");
            ReadLog("打开了模拟绘图GDI+");
            SimulationDrawing simulationdrawing = new SimulationDrawing();
            simulationdrawing.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了模拟绘图GDI+";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 调用百度地图
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MpaoolStripMenuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了调用百度地图");
            ReadLog("打开了调用百度地图");
            BaiDuMap baidumap = new BaiDuMap();
            baidumap.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了调用百度地图";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 中英文翻译
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FanYiToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了中英文翻译");
            ReadLog("打开了中英文翻译");
            MailForm mailform = new MailForm();
            mailform.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了中英文翻译";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }

        private void WindowsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了Windows系统信息查看");
            ReadLog("打开了Windows系统信息查看");
            WindowsFrm sWindowsFrm = new WindowsFrm();
            sWindowsFrm.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了Windows系统信息查看";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 查看操作系统信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TTpMenuItem_Click(object sender, EventArgs e)
        {
            Process p = new Process();
            //Process类有一个StartInfo属性，这个是ProcessStartInfo类，包括了一些属性和方法，下面我们用到了他的几个属性：
            p.StartInfo.FileName = "cmd.exe";
            p.StartInfo.Arguments = "/c winver";
            //p.StartInfo.Arguments = "/c ping 127.0.0.1" ;    //设定程式执行参数
            p.StartInfo.UseShellExecute = false;               //关闭Shell的使用
            p.StartInfo.RedirectStandardInput = true;          //重定向标准输入
            p.StartInfo.RedirectStandardOutput = true;         //重定向标准输出
            p.StartInfo.RedirectStandardError = true;          //重定向错误输出
            p.StartInfo.CreateNoWindow = true;                 //设置不显示窗口
            p.Start();                                         //启动
            p.StandardInput.WriteLine("exit");                 //不过要记得加上Exit要不然下一行程式执行的时候会当机
        }
        /// <summary>
        /// Code39条形码生成器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TowStripMenuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了Code39条形码生成器");
            ReadLog("打开了Code39条形码生成器");
            CodeBarCodeFrm codebarcodefrm = new CodeBarCodeFrm();
            codebarcodefrm.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了Code39条形码生成器";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 万年历查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void IOolStripMenuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了万年历查询");
            ReadLog("打开了万年历查询");
            Calender caleneder = new Calender();
            caleneder.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了万年历查询";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// MD5加密器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mD5lStripMenuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了MD5加密器");
            ReadLog("打开了MD5加密器");
            MD5Encryption mD5Encryption = new MD5Encryption();
            mD5Encryption.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了MD5加密器";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 集信贪吃蛇
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void JxsnakeipMenuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了集信贪吃蛇");
            ReadLog("打开了集信贪吃蛇");
            JxSnakeFrm snakeFrm = new JxSnakeFrm();
            snakeFrm.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了集信贪吃蛇";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 地铁换乘路线查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SubwaynuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了地铁换乘路线查询");
            ReadLog("打开了地铁换乘路线查询");
            frmSubwayHelper sSubwayHelper = new frmSubwayHelper();
            sSubwayHelper.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了地铁换乘路线查询";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 集信图画板
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tJxpMenuItem1_Click(object sender, EventArgs e)
        {
            _log.Info("打开了集信图画板");
            ReadLog("打开了集信图画板");
            Frm1 sPreloadFrm = new Frm1();
            sPreloadFrm.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了集信图画板";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 机器人聊天
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ChatRobot_Click(object sender, EventArgs e)
        {
            _log.Info("打开了机器人聊天");
            ReadLog("打开了机器人聊天");
            ChatFrm dChatFrm = new ChatFrm();
            dChatFrm.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了机器人聊天";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 系统日志查看器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RizhupMenuItem1_Click(object sender, EventArgs e)
        {
            _log.Info("打开了系统日志查看器");
            ReadLog("打开了系统日志查看器");
            SysLog sysLog = new SysLog();
            sysLog.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了系统日志查看器";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 五子棋
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WuZiQienuItem1_Click(object sender, EventArgs e)
        {
            _log.Info("打开了五子棋");
            ReadLog("打开了五子棋");
            Gobang sGobang = new Gobang();
            sGobang.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了系统日志查看器";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 便捷音乐播放器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void JXMUDenuItem1_Click(object sender, EventArgs e)
        {
            _log.Info("打开了便捷音乐播放器");
            ReadLog("打开了便捷音乐播放器");
            MumiMusic.Form1 sd = new MumiMusic.Form1();
            sd.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了便捷音乐播放器";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 2468小游戏
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SecondFourSixEight_Click(object sender, EventArgs e)
        {
            _log.Info("打开了2468小游戏");
            ReadLog("打开了2468小游戏"); 
            MainForm2468 form2468 = new MainForm2468();
            form2468.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了便捷音乐播放器";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 集信抽奖系统
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LotterySystem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了集信抽奖系统");
            ReadLog("打开了集信抽奖系统");
            JXOutsideSystemFrm jxoutsidesystem = new JXOutsideSystemFrm();
            jxoutsidesystem.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了集信抽奖系统";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 躲避小球
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CrazyDodgeballFrm_Click(object sender, EventArgs e)
        {
            _log.Info("打开了躲避小球");
            ReadLog("打开了躲避小球");
            app2.开始 startfrm = new app2.开始();
            startfrm.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了躲避小球";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 集信拼图游戏
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void JigsawPuzzle_Click(object sender, EventArgs e)
        {
            _log.Info("打开了集信拼图游戏");
            ReadLog("打开了集信拼图游戏");
            PuzzleFrm puzzle = new PuzzleFrm();
            puzzle.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了集信拼图游戏";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }

        private void BaiDuYuPan_Click(object sender, EventArgs e)
        {
            _log.Info("打开了集信度娘网盘搜索");
            ReadLog("打开了集信度娘网盘搜索");
            BaiduCloudSearch frm = new BaiduCloudSearch();
            frm.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了度娘网盘搜索";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 集信宿舍管理系统
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void 集信宿舍管理系统ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了集信宿舍管理系统");
            ReadLog("打开了集信宿舍管理系统");
            login frm = new login();
            frm.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了集信宿舍管理系统";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 图片像素RGB调整工具
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void JXAdjustmentTool_Click(object sender, EventArgs e)
        {
            _log.Info("打开了图片像素RGB调整工具");
            ReadLog("打开了图片像素RGB调整工具");
            ColorForm frm = new ColorForm();
            frm.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了图片像素RGB调整工具";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 定时播放器
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AutotripMenuItem_Click(object sender, EventArgs e)
        {
            _log.Info("打开了定时播放器");
            ReadLog("打开了定时播放器");
            TimingPlayer frm = new TimingPlayer();
            frm.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了定时播放器";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 屏幕取色工具
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ColorScreen_Click(object sender, EventArgs e)
        {
            _log.Info("打开了屏幕取色工具");
            ReadLog("打开了屏幕取色工具");
            MainFormColor frmColor = new MainFormColor();
            frmColor.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了屏幕取色工具";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 集信截屏工具
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SetsLetterScreenshots_Click(object sender, EventArgs e)
        {
            _log.Info("打开了集信截屏工具");
            ReadLog("打开了集信截屏工具");
            FormCSharpWinDemo frmscreen = new FormCSharpWinDemo();
            frmscreen.Show();
            MessageForm2 frm2 = new MessageForm2();
            String titleText = "消息窗";
            String contentText = "打开了集信截屏工具";
            Rectangle TitleRectangle = new Rectangle(50, 20, 45, 45);
            Rectangle TitlebarRectangle = new Rectangle(0, 0, 150, 50);
            Rectangle ContentRectangle = new Rectangle(10, 50, 130, 50);
            Rectangle CloseBtnRectangle = new Rectangle(0, 100, 150, 50);
            frm2.ShowForm(titleText, contentText, TitleRectangle, TitlebarRectangle, ContentRectangle, CloseBtnRectangle);
        }
        /// <summary>
        /// 集信面板控制
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void JXletterPanel_Click(object sender, EventArgs e)
        {
            _log.Info("打开了集信面板控制");
            ReadLog("打开了集信面板控制");
            JxPanelfrm letterPanel = new JxPanelfrm();
            letterPanel.Show();
        }
    }
}
